package base.bean;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * Standard response 标准响应体
 *
 * @description:
 * @author: cyj
 * @date 2020 -10-15 10:13:54
 */
@Data
@Accessors(chain = true)
@ApiModel("标准响应体")
public class StandardResponse<T> implements Serializable {

    /**
     * Message 描述
     */
    @ApiModelProperty("描述")
    private String message = "请求成功";

    /**
     * Code 错误码
     */
    @ApiModelProperty("错误码")
    private String code;

    /**
     * Version 版本
     */
    @ApiModelProperty("版本")
    private String version = "1.0";

    /**
     * Data 数据体
     */
    @ApiModelProperty("响应体")
    private T data;

    public StandardResponse() {
    }

    public StandardResponse(T data) {
        this.data = data;
    }

    public StandardResponse(String message) {
        this.message = message;
    }

    public StandardResponse(T data, String message) {
        this.data = data;
        this.message = message;
    }

    public StandardResponse(String message, String code) {
        this.message = message;
        this.code = code;
    }
}
